<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // es6合并对象
        //es5
        // let name = { name:'sea' },age = { age:15 },person= {}
        // Object.assign(person,name,age)
        // console.log(person) //{ name:'sea',age:15 }

        //es6
        let name = { name:'sea' },age = { age:15 }
        let person = { ...name,...age }
        console.log(person)//{ name:'sea',age:15 }
        var kvArray = [
            {
                key: 1, 
                value: 10,
            }, 
            {
                key: 11, 
                value: 110,
            }, 
        ];
        // var reformattedArray = kvArray.map(function(obj) { 
        //     var rObj = {}; 
        //     rObj[obj.key] = obj.value; 
        //     return rObj; 
        // });
        let send_arr = kvArray.map(item =>{
            let obj_ = {}
            obj_.tickNo = item.value;
            // obj.ticketType = item.cardTypeCode;
            obj_.ticketType = '1';
            return obj_
          })

        
    </script>
</body>
</html>